package com.baizhi.iox;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 块读写提升效率
 * 拷贝视频并测试性能
 */
public class VideoCopy03 {
    public static void main(String[] args) throws IOException {

        long start = System.currentTimeMillis();

        FileInputStream fis = new FileInputStream("G:/java笔记/day16/5月9日pm.mp4");
        FileOutputStream fos = new FileOutputStream("./javase_io/上课视频.mp4");

        byte[] bytes = new byte[1024 * 80]; //一次都8mb

        int d;
        while((d = fis.read(bytes))!=-1){
            fos.write(bytes,0,d);
        }

        fos.close();
        fis.close();

        long end = System.currentTimeMillis();

        System.out.println("复制完毕，耗时："+(end-start) + "ms");

    }
}
